package com.manager.gen.module.controller.user;

import com.manager.commons.annotation.Module;
import com.manager.commons.annotation.Operation;
import com.manager.commons.base.DataGrid;
import com.manager.core.module.log.aop.TMLog;
import com.manager.core.web.json.AjaxJson;
import com.manager.gen.module.entity.user.GenFeedback;
import com.manager.gen.module.service.user.GenFeedbackService;
import com.manager.gen.web.controller.AdminController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

/**
 * GenFeedbackController
 *意见反馈 
 * @author manager
 * @version 1.0
 */
@Controller()
@Module(parent = "user-manager", title = "意见反馈",sort = 2,code = "/gen/feedback")
public class GenFeedbackController extends AdminController<GenFeedback> {
    private final String baseUrl = "/gen/feedback";
    @Autowired
    private GenFeedbackService _service;

    /**
     * 列表
     *
     * @return
     */
    @TMLog(type = "mvp", description = "意见反馈列表页面")
    @RequestMapping(baseUrl+"/index")
    public ModelAndView index() {
        return getModelAndView(baseUrl + "/feedback-index");
    }


    /**
     * 新增
     *
     * @return
     */
    @TMLog(type = "mvp", description = "意见反馈详情")
    @RequestMapping(baseUrl+"/detail")
    @Operation(title = "详情")
    public ModelAndView detail() {
        return getModelAndView(baseUrl + "/feedback-detail", _service.findMap(getParams()));
    }

    /**
     * 删除数据
     *
     * @return
     */
    @RequestMapping(value = baseUrl+"/delete", method = RequestMethod.POST)
    public @ResponseBody AjaxJson delete() {
        return _service.delete(getParams());
    }



    /**
     * 分页
     *
     * @return
     */
    @TMLog(type = "rmp", description = "意见反馈列表分页[post]。")
    @RequestMapping(value = baseUrl+"/list")
    @Operation(title = "列表")
    public @ResponseBody DataGrid page() {
        return _service.queryPage(getParams());
    }


    /**
     * 改变数据状态
     *
     * @return
     */
    @TMLog(type = "rmp", description = "修改意见反馈数据状态(禁用/启用)[post]。")
    @PostMapping(value = baseUrl+"/status")
    @Operation(title = "状态修改")
    public @ResponseBody AjaxJson status() {
        return _service.status(getParams());
    }



    @Override
    public GenFeedback getModel() {
        return new GenFeedback();
    }

}
